package com.face.console.dao;

import com.face.console.pojo.dto.FieldDto;
import com.face.console.pojo.vo.FieldVo;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface FieldDtoMapper {
    @Delete({
            "delete from face_field",
            "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
            "insert into face_field (id, field_name, ",
            "address, x, y, ",
            "tp_url, f_type_id)",
            "values (#{id,jdbcType=BIGINT}, #{fieldName,jdbcType=VARCHAR}, ",
            "#{address,jdbcType=VARCHAR}, #{x,jdbcType=VARCHAR}, #{y,jdbcType=VARCHAR}, ",
            "#{tpUrl,jdbcType=VARCHAR}, #{fTypeId,jdbcType=VARCHAR})"
    })
    int insert(FieldDto record);

    int insertSelective(FieldDto record);

    @Select({
            "select",
            "id, field_name, address, x, y, tp_url, f_type_id",
            "from face_field",
            "where id = #{id,jdbcType=BIGINT}"
    })
    FieldDto selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(FieldDto record);

    @Update({
            "update face_field",
            "set field_name = #{fieldName,jdbcType=VARCHAR},",
            "address = #{address,jdbcType=VARCHAR},",
            "x = #{x,jdbcType=VARCHAR},",
            "y = #{y,jdbcType=VARCHAR},",
            "tp_url = #{tpUrl,jdbcType=VARCHAR},",
            "f_type_id = #{fTypeId,jdbcType=VARCHAR}",
            "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(FieldDto record);

    List<FieldVo> fields(@Param("query") FieldDto query);
}